url = 'https://www.acwing.com/problem/content/788/'

def quick_sort(q, l, r, k):
    if l >= r:
        return q[l]
    i, j = l - 1, r + 1
    x = q[(l + r) // 2]
    while i < j:
        i += 1
        while q[i] < x:
            i += 1
        j -= 1
        while q[j] > x:
            j -= 1
        if i < j:
            q[i], q[j] = q[j], q[i]
    # 注意这里的符号是 ">="，而不是 ">"，因为题目中是求第 k 小的数，而不是第 k 大
    if j - l + 1 >= k:  
        return quick_sort(q, l, j, k)
    else:
        return quick_sort(q, j + 1, r, k - (j - l + 1))

n, k = map(int, input().split())
q = list(map(int, input().split()))

print(quick_sort(q, 0, n - 1, k))

